package com.linkdood.app.schedule;

import com.linkdood.app.service.AttachmentService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

/**
 * 定时下载 attachment 中失败或未下载的文件
 *
 * @author Zchen
 */
@Slf4j
@Component
public class SyncAttachmentFileTask extends QuartzJobBean {

    /**
     * 此处必须要使用 Autowired 或者 Setter,不可以使用构造器
     */
    @Autowired
    private AttachmentService attachmentService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) {
        log.debug("start sync attachment file schedule task");
        attachmentService.syncAttachmentFile();
        log.debug("end sync attachment file schedule task");
    }
}
